package edu.gdkm.mapper;

import edu.gdkm.controller.request.BaseRequest;
import edu.gdkm.controller.request.LoginRequest;
import edu.gdkm.controller.request.PasswordRequest;
import edu.gdkm.entity.Admin;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface AdminMapper {
//    @Select("select * from user ")
    List<Admin> list();

    List<Admin> listByCondition(BaseRequest baseRequest);

    void save(Admin obj);

    /**
     * 通过id获取用户数据(修改用户)
     * @return
     */
    Admin getById(Integer id);

    /**
     * 修改用户 通过id
     * @param user
     * @return
     */
    void updateById(Admin admin);

    /**
     * 删除用户
     * @param id
     */
    void deleteById(Integer id);

    /**
     * 验证登录信息
     * @param request
     * @return
     */
    Admin getByUsernameAndPassword(@Param("username") String username, @Param("password") String password);

    int updatePassword(PasswordRequest passwordRequest);

    /**
     * 查询用户通过用户名
     * @param username
     * @return
     */
    Admin getByUsername(String username);
}
